/**
 * 
 */

package com.chengyu.eyc.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.chengyu.eyc.base.ResponseResult;
import com.chengyu.eyc.enums.ConfigTypeEnum;
import com.chengyu.eyc.enums.PublishInfoStatusEnum;
import com.chengyu.eyc.model.EycAdInfo;
import com.chengyu.eyc.model.EycDataConfig;
import com.chengyu.eyc.model.EycInspPriceRule;
import com.chengyu.eyc.model.EycInspRule;
import com.chengyu.eyc.model.EycInspStationWorkday;
import com.chengyu.eyc.model.EycParmPickupCar;
import com.chengyu.eyc.model.EycPublicInfo;
import com.chengyu.eyc.model.EycVehicleMaintQa;
import com.chengyu.eyc.service.EycBaseService;

/**
 * @author kevin
 *
 */
@RequestMapping("wechat/baseConfig")
@RestController
public class BaseConfigController extends AbstractBaseController {

    @Autowired
    private EycBaseService eycBasicService;

    /**
     * 查询基础配置
     * 
     * @param typeCdes
     * @return
     */
    @PostMapping("searchConfigByTypeCdes")
    public ResponseResult<Map<String, List<EycDataConfig>>> searchConfigByTypeCdes(@RequestBody List<String> typeCdes) {
        return ResponseResult.ok(this.eycBasicService.searchConfigByTypeCdes(typeCdes));
    }

    @PostMapping("searchEycVehicleMaintQa")
    public ResponseResult<List<EycVehicleMaintQa>> searchEycVehicleMaintQa() {
        return ResponseResult.ok(this.eycBasicService.searchEycVehicleMaintQa());
    }

    /**
     * 查询车联年检年检价格
     * 
     * @return
     */
    @PostMapping("searchMatchInspPriceRule")
    public ResponseResult<EycInspPriceRule> searchMatchInspPriceRule(@RequestBody Map<String, String> params) {
        return ResponseResult.ok(this.eycBasicService.searchMatchInspPriceRule(params));
    }

    /**
     * 查询年检规则
     * 
     * @return
     */
    @PostMapping("searchMatchInspRule")
    public ResponseResult<EycInspRule> searchMatchInspRule(@RequestBody Map<String, String> params) {
        return ResponseResult.ok(this.eycBasicService.searchMatchInspRule(params));
    }
    
    @PostMapping("searchNumberOfCarPickupDaily")
    public ResponseResult<EycParmPickupCar> searchNumberOfCarPickupDaily() {
        return ResponseResult.ok(this.eycBasicService.searchNumberOfCarPickupDaily());
    }

    /**
     * 查询页面配置
     * 
     * @param pageCde
     * @param typeCde
     * @return
     */
    @PostMapping("searchPageConfigByTypeCde")
    public ResponseResult<List<EycPublicInfo>> searchPageConfigByTypeCde(String pageCde, String typeCde) {
        return ResponseResult.ok(this.eycBasicService.searchPageConfigByTypeCde(pageCde, typeCde, PublishInfoStatusEnum.FILE.getCode()));
    }

    /**
     * 查询小程序首页系统公告、新闻资讯等内容
     * 
     * @param typeCdes
     * @return
     */
    @PostMapping("searchPublishInfoByTypeCdes")
    public ResponseResult<List<EycPublicInfo>> searchPublishInfoByTypeCdes(@RequestBody List<String> typeCdes) {
        return ResponseResult.ok(this.eycBasicService.searchPublishInfoByTypeCdes(typeCdes));
    }
    
    /**
     * 查询轮播图
     * @return
     */
    @PostMapping("searchCarouselPictures")
    public ResponseResult<List<EycAdInfo>> searchCarouselPictures() {
        return ResponseResult.ok(this.eycBasicService.searchCarouselPictures());
    }

    /**
     * 查询车辆类型列表
     * 
     * @return
     */
    @PostMapping("searchVehicleTypes")
    public ResponseResult<List<EycDataConfig>> searchVehicleTypes() {
        return ResponseResult.ok(this.eycBasicService.searchConfigByTypeCde(ConfigTypeEnum.VEHICLE_TYPE.getCode()));
    }
    
    @PostMapping("searchInspStationWorkdays")
    public ResponseResult<List<EycInspStationWorkday>> searchInspStationWorkdays(String startDate,String endDate) {
        return ResponseResult.ok(this.eycBasicService.searchInspStationWorkdays(startDate, endDate));
    }
    
  
    
    

}
